package com.orcwar.gui.activities;

import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Window;
import android.widget.LinearLayout;

import com.orcwar.R;
import com.orcwar.enums.OWUnitClass;
import com.orcwar.gui.views.OWClassDescriptionView;

public class OWCharacterSelectActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);

		setContentView(R.layout.character_select_main);
		LayoutInflater inflater = getLayoutInflater();
		// add 4 slots
		LinearLayout left = (LinearLayout) findViewById(R.id.charactersLeft);
		inflater.inflate(R.layout.character_info, left);
		inflater.inflate(R.layout.character_info, left);

		LinearLayout right = (LinearLayout) findViewById(R.id.charactersRight);
		inflater.inflate(R.layout.character_info, right);
		inflater.inflate(R.layout.character_info, right);

		// add classes
		LinearLayout leftLayout = (LinearLayout) findViewById(R.id.classLeft);
		LinearLayout rightLayout = (LinearLayout) findViewById(R.id.classRight);
		boolean insertLeft = true;
		for (OWUnitClass unitClass : OWUnitClass.values()) {
			OWClassDescriptionView descriptionView = (OWClassDescriptionView) inflater
					.inflate(R.layout.class_description, null);
			descriptionView.init(unitClass);
			if (insertLeft) {
				leftLayout.addView(descriptionView);
			} else {
				rightLayout.addView(descriptionView);
			}

			insertLeft = !insertLeft;

		}

	}

}
